package com.jak.config;

import org.apache.http.HttpHost;
import org.elasticsearch.client.RestClient;
import org.elasticsearch.client.RestClientBuilder;
import org.elasticsearch.client.RestHighLevelClient;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @author Jiang Akang
 * employeeId: BG435424
 * @date 2021/3/16
 **/
@Configuration //xml
public class ElasticSearchConfig {

    @Bean
    public RestHighLevelClient restHighLevelClient() {
        HttpHost http = new HttpHost("192.168.56.10", 9200, "http");
        RestClientBuilder builder = RestClient.builder(http);
        RestHighLevelClient client = new RestHighLevelClient(builder);
        return client;
    }
}
